Skip to content

fix(pi-tree): load runtime bundle modules for pi >= 0.84.3 - #6

Merged
zigai merged 3 commits into
zigai:masterfrom
mystery4f:fix/pi-tree-runtime-bundle
Sep 7, 2026
Merged

zigai merged 3 commits into
zigai:masterfrom
mystery4f:fix/pi-tree-runtime-bundle

Conversation

@mystery4f

@mystery4f mystery4f commented Sep 7, 2026 •

Copy link
Copy Markdown
Contributor

Problem

Pi's bundled CLI uses a different tree-selector class from the modular files under dist/modes/. Patching the modular copy leaves the actual /tree UI without pi-tree's timestamps and preview behavior.

Change

Load the tree selector and theme through loadPiRuntimeModule from the published @zigai/pi-extension-internals@0.1.2 package. Keep guarded runtime discovery in that shared package and remove the vendored loader from pi-tree.

Update pi-tree's exact runtime dependency and regenerate the npm lockfile, removing its stale nested internals 0.1.0 entry. Add regression tests that compare the loaded constructor with the constructor used by a bundled or modular host; the bundled fixture also contains a separate modular class to reproduce the original failure.

Verification

  • npm run check: passed, including 71 test files / 363 tests and managed-install package loading. Pre-commit checks remain enabled.
  • Regression test fails on constructor identity when temporarily switched back to loadPiInternalModule, and passes with the runtime loader.
  • Clean installation of the pi-tree tarball resolves the published internals 0.1.2 dependency without Pi host peers in the extension's dependency tree.
  • Upgrading published pi-tree 0.5.3 to the revised tarball replaces internals 0.1.0 with 0.1.2 through ordinary npm install.
  • Real bundled Pi 0.85.1 TUI, for both clean and upgraded installations: /tree presents timestamp prefixes and selected-message preview content; pressing P changes Preview: On to Preview: Off. Both recorded Termtrace scenarios pass.

This change reuses the published shared loader as-is; broader changes to its fallback policy are separate shared-package work.

mystery4f and others added 3 commits September 7, 2026 14:30
pi 0.84.3 switched the CLI/RPC entrypoints to a bundled runtime, leaving
the dist/modes modular files as a second, unused copy at CLI runtime.
pi-tree patched that dead copy, so /tree patches silently never applied.

Load internals via loadPiRuntimeModule (pi-extension-internals 0.1.2),
which prefers the running bundle entrypoint chunks before the modular
fallback, and bump the dependency accordingly.
npm lockfiles can shadow the hoisted @zigai/pi-extension-internals with an
older nested copy (0.1.0) that lacks loadPiRuntimeModule, breaking the
extension at import time. Inline the loader (from internals 0.1.2, MIT) so
pi-tree is self-contained.
@zigai

zigai commented Sep 7, 2026

Copy link
Copy Markdown
Owner

Thanks. I added a commit to keep the loader in the shared internals package. LGTM.

@zigai
zigai merged commit 5a2bae2 into zigai:master Sep 7, 2026
1 check passed
zigai pushed a commit that referenced this pull request Oct 10, 2026
* Make goal lifecycle transitions terminal and idempotent.

Enforce state-machine guards so completed goals cannot be reopened by pause/resume or duplicate complete writes, allow create_goal to replace completed goals, skip unchanged runtime/compaction snapshots, and throw from failed goal tools per pi contract.

Closes #6

Co-authored-by: Cursor <cursoragent@cursor.com>

* Align create_goal model guidance with create-after-complete semantics.

Update tool prompts, failure copy, and tests so non-complete goals block duplicate create while completed goals can be replaced.

Co-authored-by: Cursor <cursoragent@cursor.com>

---------

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants